﻿Imports System.Collections.Generic
Imports System.Linq
Imports System.Net
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Shapes
Imports FirstFloor.Documents.IO
Imports FirstFloor.Documents.Controls
Imports FirstFloor.Documents.Pdf
Imports System.IO

Partial Public Class PDFViewer
    Inherits UserControl

    Public Sub New(pdfdoc As Byte())
        InitializeComponent()

        Dim xstreamer As New MemoryStream()
        Using xstreamer
            xstreamer.Write(pdfdoc, 0, pdfdoc.Length)
        End Using
        Me.DataSource.PackageReader = New PdfDocumentReader(New Uri(xstreamer.ToString, UriKind.Relative))
    End Sub

    Private Sub DataSource_LoadError(sender As Object, e As ErrorEventArgs)
        MessageBox.Show(e.[Error].Message)
    End Sub

End Class
